import axios from '../../util/http'
import * as api from '../../util/api'
const state ={
       /* orderAmount:'',
        orderNumber:'',
        returnOrderAmount:'',
        returnOrderNumber:'',
        orderMainList:[],*/
       tableData:[]


};
const mutations ={
    selectData(state,obj){
       /* state.tableData.orderMainList = obj.orderMainList
        state.tableData.orderAmount=obj.orderAmount
        state.tableData.orderNumber=obj.orderNumber
        state.tableData.returnOrderAmount=obj.returnOrderAmount
        state.tableData.returnOrderNumber=obj.returnOrderNumber*/
       /* var arr=Object.values(obj)
        state.tableData[0]=arr*/
      state.tableData=obj
       /* tableData:{orderAmount,orderNumber,returnOrderAmount,returnOrderNumber,orderMainList}*/





    },
    selectByTimeData(state,obj){
        state.orderMainList = obj.orderMainList
        state.orderAmount=obj.orderAmount
        state.orderNumber=obj.orderNumber
        state.returnOrderAmount=obj.returnOrderAmount
        state.returnOrderNumber=obj.returnOrderNumber

}
};
const actions={
    getOrderStatisticData({commit},obj){
        return axios({
            url:api.orderStatistics,
            method:'get',
           /* data:obj*/
        }).then(res=>{
            console.log(11123)
            console.log(res)
            console.log(res.data.data)
            commit('selectData',res.data.data)
            return res.code

        })
    },
    selectOrderStatisticData({commit},obj){
        return axios({
            url:api.queryOrderByTime,
            method:'post',
            data:obj
        }).then(res=>{
            console.log(11123)
            console.log(res)
            commit('selectByTimeData',res.data)
            return res.code

        })
    }
};
const getters ={

};
export default{
    state,
    actions,
    mutations,
    getters
}